Skip to main content
PUT
Attach customer to plan

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required
planId
string
required

Body

application/json

Upsert billing policy payload

mode
enum<string>
required

Billing mode.

  • wallet: Charges a monetary wallet.
  • credits: Consumes a credit balance.
  • windows: Meters weighted units against rolling allowances.
Available options:
wallet,
credits,
windows
Example:

"wallet"

blocked
boolean
required

Whether spending is disabled for this billing scope.

Example:

false

wallet_id
string | null

ID of the customer wallet the policy charges. Omit on wallet policy writes to provision or reuse the customer's wallet.

Minimum string length: 1
Example:

"wal_example"

credit_product_id
string | null

ID of the credit product whose balance this policy consumes. The plan's credit product when the plan names one. On policy writes, may be omitted when the plan names one, and a different product is rejected.

Minimum string length: 1
Example:

"prd_credits"

parent_balance_enabled
boolean

Whether this plan attachment draws from its parent organisation's balance: the parent's attachment to the same plan, or further up while that one has the option on too. Usage, prices and the ledger stay on this customer. Plan attachments only. On policy writes, omission keeps the current value (false on creation), and enabling it is rejected while the parent chain has no balance to draw from.

Example:

false

markup_percent
string | null

Percentage added to resolved cost. Null on writes means no override; an attached plan may supply the value.

Maximum string length: 40
Pattern: ^\d+(\.\d+)?$
Example:

"20"

overage_mode
enum<string> | null

Behavior when credits or an allowance are exhausted. Policy values may inherit the attached plan.

  • refuse: Rejects the call that crosses the boundary without deducting usage.
  • metered: Prices the whole call as monetary overage, using the overage card or USD provider cost plus markup.
  • usage_events: Accepts the call as overage and bills it as usage events (event_type: ai_overage_usage, one per item with its units) priced by your catalog. overage_markup_percent and overage_rate_card_id must be null. Not available in wallet mode.
Available options:
refuse,
metered,
usage_events
Example:

"metered"

overage_markup_percent
string | null

Percentage added to provider cost for overage. Mutually exclusive with overage_rate_card_id. Null when overage_mode is usage_events.

Maximum string length: 40
Pattern: ^\d+(\.\d+)?$
Example:

"10"

overage_rate_card_id
string | null

ID of the currency rate card used to price overage directly. Null means provider cost plus the resolved overage markup.

Minimum string length: 1
Example:

"airc_overage"

overage_wallet_id
string | null

ID of the wallet charged for overage. Null bills overage in arrears.

Minimum string length: 1
Example:

"wal_example"

floor
string | null

Minimum available balance a spend check requires, in the policy's denomination.

Maximum string length: 40
Pattern: ^\d+(\.\d+)?$
Example:

"0"

settlement_interval_minutes
integer | null

Settlement interval in minutes. Null means no interval override. Mutually exclusive with settlement_schedule.

Required range: 60 <= x <= 44640
Example:

60

settlement_schedule
enum<string> | null

Calendar settlement schedule. Null clears the override; mutually exclusive with settlement_interval_minutes.

  • calendar_month: Settles at the end of each UTC calendar month.
Available options:
calendar_month
Example:

"calendar_month"

windows
object[]

Rolling allowances. Required for windows plans; each window meters every call. A plan replacement replaces the entire array.

Required array length: 1 - 8 elements
Example:
rate_card_id
string | null

ID of the attached rate card. On policy writes, omission preserves the current reference and null detaches it; on plan replacement omission clears it.

Minimum string length: 1
Example:

"airc_example"

agent_rate_cards
object[]

The customer's rate card for one agent at a time. It prices that agent's records first and falls through row by row to the policy's card, the plan's card for the agent, then the plan's card. At most one entry per agent. On writes, omission keeps the current list and an empty list clears it.

Maximum array length: 200
Example:
plan_id
string | null

ID of the attached billing plan. On policy writes, omission preserves the current plan and null detaches it.

Minimum string length: 1
Example:

"aiplan_example"

Response

id
string
required

Resource ID.

Example:

"d18603dd-7285-4bf5-a45e-88d7de8f37c9"

customer_id
string
required

ID of the customer the policy applies to.

Example:

"cus_example"

agent_slug
string | null
required

Agent scope identifier. Null is the customer's shared pool or a plan attachment.

Example:

"support"

is_default
boolean
required

Whether this is the default plan or shared customer scope.

Example:

false

scope
enum<string>
required

What this policy is: default (the customer's first attachment, a plan or custom terms), plan (an additional plan attachment, addressed by plan) or agent (a legacy per-agent policy, which bills that agent first).

Available options:
default,
plan,
agent
Example:

"default"

mode
enum<string>
required

Billing mode.

  • wallet: Charges a monetary wallet.
  • credits: Consumes a credit balance.
  • windows: Meters weighted units against rolling allowances.
Available options:
wallet,
credits,
windows
Example:

"wallet"

wallet_id
string | null
required

ID of the customer wallet the policy charges. Omit on wallet policy writes to provision or reuse the customer's wallet.

Example:

"wal_example"

credit_product_id
string | null
required

ID of the credit product whose balance this policy consumes. The plan's credit product when the plan names one. On policy writes, may be omitted when the plan names one, and a different product is rejected.

Example:

"prd_credits"

parent_balance_enabled
boolean
required

Whether this plan attachment draws from its parent organisation's balance: the parent's attachment to the same plan, or further up while that one has the option on too. Usage, prices and the ledger stay on this customer. Plan attachments only. On policy writes, omission keeps the current value (false on creation), and enabling it is rejected while the parent chain has no balance to draw from.

Example:

false

balance_customer_id
string | null
required

ID of the customer whose balance this policy draws from: the policy's own customer, or the parent organisation holding it when parent_balance_enabled is true. Null when the parent chain has no balance to draw from, in which case consumption is rejected as for a policy with no balance.

Example:

"cus_example"

markup_percent
string
required

Percentage added to resolved cost. Null on writes means no override; an attached plan may supply the value.

Pattern: ^-?\d+(\.\d+)?(e[+-]?\d+)?$/i
Example:

"20"

overage_mode
enum<string>
required

Behavior when credits or an allowance are exhausted. Policy values may inherit the attached plan.

  • refuse: Rejects the call that crosses the boundary without deducting usage.
  • metered: Prices the whole call as monetary overage, using the overage card or USD provider cost plus markup.
  • usage_events: Accepts the call as overage and bills it as usage events (event_type: ai_overage_usage, one per item with its units) priced by your catalog. overage_markup_percent and overage_rate_card_id must be null. Not available in wallet mode.
Available options:
refuse,
metered,
usage_events
Example:

"metered"

overage_markup_percent
string | null
required

Percentage added to provider cost for overage. Mutually exclusive with overage_rate_card_id. Null when overage_mode is usage_events.

Pattern: ^-?\d+(\.\d+)?(e[+-]?\d+)?$/i
Example:

"10"

overage_rate_card_id
string | null
required

ID of the currency rate card used to price overage directly. Null means provider cost plus the resolved overage markup.

Example:

"airc_overage"

overage_rate_card_source
enum<string> | null
required

Source of the effective overage rate card. Null when no card is configured.

  • policy: Selected directly on the customer policy.
  • plan: Inherited from the attached plan.
Available options:
policy,
plan
Example:

"plan"

overage_wallet_id
string | null
required

ID of the wallet charged for overage. Null bills overage in arrears.

Example:

"wal_example"

floor
string
required

Minimum available balance a spend check requires, in the policy's denomination.

Pattern: ^-?\d+(\.\d+)?(e[+-]?\d+)?$/i
Example:

"0"

windows
object[]
required

Rolling allowances. Required for windows plans; each window meters every call. A plan replacement replaces the entire array.

Example:
rate_card_id
string | null
required

ID of the attached rate card. On policy writes, omission preserves the current reference and null detaches it; on plan replacement omission clears it.

Example:

"airc_example"

rate_card_source
enum<string> | null
required

Source of the effective rate card. Null when no card is configured.

  • policy: Selected directly on the customer policy.
  • plan: Inherited from the attached plan.
Available options:
policy,
plan
Example:

"policy"

agent_rate_cards
object[]
required

The customer's rate card for one agent at a time. It prices that agent's records first and falls through row by row to the policy's card, the plan's card for the agent, then the plan's card. At most one entry per agent. On writes, omission keeps the current list and an empty list clears it.

Example:
plan_id
string | null
required

ID of the attached billing plan. On policy writes, omission preserves the current plan and null detaches it.

Example:

"aiplan_example"

settlement_interval_minutes
number | null
required

Settlement interval in minutes. Null means no interval override. Mutually exclusive with settlement_schedule.

Example:

60

settlement_schedule
enum<string> | null
required

Calendar settlement schedule. Null clears the override; mutually exclusive with settlement_interval_minutes.

  • calendar_month: Settles at the end of each UTC calendar month.
Available options:
calendar_month
Example:

"calendar_month"

resolved_rate_card
object | null
required

Summary of the effective pricing after applying rate-card inheritance. Null when no card resolves.

Example:
overrides
object
required

Pricing, window and settlement overrides before plan inheritance; null means no override. Use these values when editing configuration.

Example:
effective_settlement_interval_minutes
number | null
required

Settlement interval after plan inheritance.

Example:

60

effective_settlement_schedule
enum<string> | null
required

Settlement schedule after plan inheritance.

Available options:
calendar_month
Example:

null

blocked
boolean
required

Whether spending is disabled for this billing scope.

Example:

false

created_at
string<date-time>
required

Creation time as a UTC ISO 8601 timestamp.

Example:

"2026-09-01T00:00:00Z"

updated_at
string<date-time>
required

Last update time as a UTC ISO 8601 timestamp.

Example:

"2026-09-02T12:00:00Z"